<?  
    $img = imagecreatetruecolor(135,16);
        
    if ($img) {
        $black = imagecolorallocate($img,0,0,0);
        $white = imagecolorallocate($img,255,255,255);
        imagefilledrectangle($img,0,0,135,16,$white);
        
        imagerectangle($img,0,0,102,15,$black);
        if ($_GET['percentage']) {
            $color = null;
            if ($_GET['percentage'] > 80) {
                $color = imagecolorallocate($img,0,200,0);
            }
            else if ($_GET['percentage'] > 50) {
                $color = imagecolorallocate($img,255,255,0);
            }
            else if ($_GET['percentage'] > 30) {
                $color = imagecolorallocate($img,255,106,0);
            }
            else {
                $color = imagecolorallocate($img,255,0,0);
            }
                
            $percentage = $_GET['percentage'] . '%';
            imagefilledrectangle($img,1,1,101 * ($_GET['percentage'] / 100),14,$color);
            imagestring($img,2,104,2,$percentage,$black);
        }
        
        header("Content-type: image/png");
        imagepng($img);
    }
    else echo "Error creating image...";
?>